<%--
 - Copyright (c) 2009-2011 ETCORE Labs. All rights reserved. 
 - 
 - This software is the confidential and proprietary information of ETCORE Labs. 
 - You shall not disclose such confidential information and shall use it only
 - in accordance with the terms of the license agreement you entered into
 - with ETCORE Labs.
 -
 - Support can be obtained from support forums at:
 - http://www.etcore.com/
 -
 - @author: ETCORE GroupTalk developers
 -
 --%>
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://www.etcore.com/grouptalk" prefix="grouptalk"%>
<%@ taglib uri="http://jakarta.apache.org/taglibs/core" prefix="c"%>
<html>
<head>
<link rel="stylesheet" href="/group/css/styles.css" type="text/css">
<script type="text/javascript"
	src="/group/ui-component/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
	tinyMCE.init({
		 // General options
         mode : "exact",
        elements : "content",
        theme : "advanced",
        plugins : "spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
        <c:if test="${lang eq 'local'}"> language: "zh",</c:if>
        
        // Theme options
        theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
        theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
        theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
        theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true,
        theme_advanced_source_editor_height:"350",
        // Skin options
        skin : "o2k7",
        skin_variant : "silver"
	});
</script>
<style>
body {
	font-size: 12px;
	font-family: Verdana, Arial, "宋体";
}

a:link {
	color: #464646;
	text-decoration: none;
}

a:visited {
	color: #464646;
	text-decoration: none;
}

a:hover {
	color: #ed145b;
	text-decoration: underline;
}

a:active {
	color: #ed145b;
	text-decoration: underline;
}

td {
	font-size: 12px
}

/*Date*/
.header {
	font: 12px Arial, Tahoma !important;
	font-weight: bold !important;
	font: 11px Arial, Tahoma;
	font-weight: bold;
	color: #154BA0;
	background: #C2DEED;
	height: 25px;
	padding-left: 10px;
}

.header td {
	padding-left: 10px;
}

.header a {
	color: #154BA0;
}

.header input {
	background: none;
	vertical-align: middle;
	height: 16px;
}

.category {
	font: 12px Arial, Tahoma !important;
	font: 11px Arial, Tahoma;
	color: #92A05A;
	height: 20px;
	background-color: #FFFFD9;
}

.category td {
	border-bottom: 1px solid #DEDEB8;
}

.expire,.expire a:link,.expire a:visited {
	color: #999999;
}

.default,.default a:link,.default a:visited {
	color: #000000;
}

.checked,.checked a:link,.checked a:visited {
	color: #FF0000;
}

.today,.today a:link,.today a:visited {
	color: #00BB00;
}

#calendar_year {
	display: none;
	line-height: 130%;
	background: #FFFFFF;
	position: absolute;
	z-index: 1005;
}

#calendar_year .col {
	float: left;
	background: #FFFFFF;
	margin-left: 1px;
	border: 1px solid #86B9D6;
	padding: 4px;
}

#calendar_month {
	display: none;
	background: #FFFFFF;
	line-height: 130%;
	border: 1px solid #86B9D6;
	padding: 4px;
	position: absolute;
	z-index: 1006;
}

.tableborder {
	background: white;
	border: 1px solid #86B9D6;
}

#year,#month {
	padding-right: 10px;
	background: url(/group/ui-component/calendar/js/onbottom.gif) no-repeat center right;
}
/*Date*/
</style>

<script language="javascript">
		function checkAddMessageForm()
		{
		 
		  if(AddMessageForm.name.value==""||AddMessageForm.name.value.replace(/(^\s*)|(\s*$)/g, "")=="")
		  {
		   alert("<c:out value='${context.msg_title_null }' />");
		   AddMessageForm.name.focus();
		   return false;
		  }
		  if(AddMessageForm.tid.value==""||AddMessageForm.tid.value=="-1")
		  {
		  alert("<c:out value='${context.msg_topic_error }' />");
		  AddMessageForm.tid.focus();
		  return false;
		  }
 
		  return true;
		}

 
			</script>


<script>
var ie =navigator.appName=="Microsoft Internet Explorer"?true:false;
function $(objID){
	return document.getElementById(objID);
}

function  showAddControl(){
	showDivControl('addControl',650,450); 
 if(parent.document.body.scrollTop>0)
parent.window.scroll(0,parent.document.body.scrollTop+20);
 else parent.window.scroll(0,80);
}

 
</script>
<SCRIPT language=JavaScript>
var gFtv=new Array();
<c:set var="eventCount" value="0" />
<c:forEach var="event" items="${targetCalendarEvents}"> 
gFtv[<c:out value="${eventCount}" />]="<c:out value="${event}" escapeXml="false"/>";
<c:set var="eventCount" value="${eventCount+1}" /> 
</c:forEach> 


function getXPos(o){
    var x = 0;
    do{
        x += o.offsetLeft;
      
    }while(o=o.offsetParent);
    return x;
}
function getYPos(o){
    var  y = 0;
    do{
    
        y += o.offsetTop;
    }while(o=o.offsetParent);
    return y;
}
 

var  lunarInfo=new  Array(
0x04bd8,0x04ae0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2,
0x04ae0,0x0a5b6,0x0a4d0,0x0d250,0x1d255,0x0b540,0x0d6a0,0x0ada2,0x095b0,0x14977,
0x04970,0x0a4b0,0x0b4b5,0x06a50,0x06d40,0x1ab54,0x02b60,0x09570,0x052f2,0x04970,
0x06566,0x0d4a0,0x0ea50,0x06e95,0x05ad0,0x02b60,0x186e3,0x092e0,0x1c8d7,0x0c950,
0x0d4a0,0x1d8a6,0x0b550,0x056a0,0x1a5b4,0x025d0,0x092d0,0x0d2b2,0x0a950,0x0b557,
0x06ca0,0x0b550,0x15355,0x04da0,0x0a5d0,0x14573,0x052d0,0x0a9a8,0x0e950,0x06aa0,
0x0aea6,0x0ab50,0x04b60,0x0aae4,0x0a570,0x05260,0x0f263,0x0d950,0x05b57,0x056a0,
0x096d0,0x04dd5,0x04ad0,0x0a4d0,0x0d4d4,0x0d250,0x0d558,0x0b540,0x0b5a0,0x195a6,
0x095b0,0x049b0,0x0a974,0x0a4b0,0x0b27a,0x06a50,0x06d40,0x0af46,0x0ab60,0x09570,
0x04af5,0x04970,0x064b0,0x074a3,0x0ea50,0x06b58,0x055c0,0x0ab60,0x096d5,0x092e0,
0x0c960,0x0d954,0x0d4a0,0x0da50,0x07552,0x056a0,0x0abb7,0x025d0,0x092d0,0x0cab5,
0x0a950,0x0b4a0,0x0baa4,0x0ad50,0x055d9,0x04ba0,0x0a5b0,0x15176,0x052b0,0x0a930,
0x07954,0x06aa0,0x0ad50,0x05b52,0x04b60,0x0a6e6,0x0a4e0,0x0d260,0x0ea65,0x0d530,
0x05aa0,0x076a3,0x096d0,0x04bd7,0x04ad0,0x0a4d0,0x1d0b6,0x0d250,0x0d520,0x0dd45,
0x0b5a0,0x056d0,0x055b2,0x049b0,0x0a577,0x0a4b0,0x0aa50,0x1b255,0x06d20,0x0ada0)

var  solarMonth=new  Array(31,28,31,30,31,30,31,31,30,31,30,31);
var  Gan=new  Array("甲","乙","丙","丁","戊","己","庚","辛","壬","癸");
var  Zhi=new  Array("子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥");
var  Animals=new  Array("鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪");
var  solarTerm  =  new  Array("小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至")
var  sTermInfo  =  new  Array(0,21208,42467,63836,85337,107014,128867,150921,173149,195551,218072,240693,263343,285989,308563,331033,353350,375494,397447,419210,440795,462224,483532,504758)

<c:if test="${lang eq 'local'}"> var  nStr1  =  new  Array('日','一','二','三','四','五','六'); </c:if>
<c:if test="${lang eq 'en'}"> var  nStr1  =  new  Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); </c:if>
var  nStr2  =  new  Array('初','十','廿','卅','　')


 

 
 

/*****************************************************************************
日期计算
*****************************************************************************/

//======================================  传回农历  y年的总天数
function  lYearDays(y)  {
var  i,  sum  =  348
for(i=0x8000;  i>0x8;  i>>=1)  sum  +=  (lunarInfo[y-1900]  &  i)?  1:  0
return(sum+leapDays(y))
}

//======================================  传回农历  y年闰月的天数
function  leapDays(y)  {
if(leapMonth(y))    return((lunarInfo[y-1900]  &  0x10000)?  30:  29)
else  return(0)
}

//======================================  传回农历  y年闰哪个月  1-12  ,  没闰传回  0
function  leapMonth(y)  {
return(lunarInfo[y-1900]  &  0xf)
}

//======================================  传回农历  y年m月的总天数
function  monthDays(y,m)  {
return(  (lunarInfo[y-1900]  &  (0x10000>>m))?  30:  29  )
}

//======================================  算出农历,  传入日期物件,  传回农历日期物件
//                                                                              该物件属性有  .year  .month  .day  .isLeap  .yearCyl  .dayCyl  .monCyl
function  Lunar(objDate)  {

var  i,  leap=0,  temp=0;
var  baseDate  =  new  Date(1900,0,31);
 
var  offset      =  (objDate  -  baseDate)/86400000;

this.dayCyl  =  offset  +  40
this.monCyl  =  14

for(i=1900;  i<2050  &&  offset>0;  i++)  {
temp  =  lYearDays(i)
 
offset  -=  temp
this.monCyl  +=  12
}

if(offset<0)  {
offset  +=  temp;
i--;
this.monCyl  -=  12
}

this.year  =  i
this.yearCyl  =  i-1864

leap  =  leapMonth(i)  //闰哪个月
this.isLeap  =  false

for(i=1;  i<13  &&  offset>0;  i++)  {
//闰月
if(leap>0  &&  i==(leap+1)  &&  this.isLeap==false)
{  --i;  this.isLeap  =  true;  temp  =  leapDays(this.year);  }
else
{  temp  =  monthDays(this.year,  i);  }

//解除闰月
if(this.isLeap==true  &&  i==(leap+1))  this.isLeap  =  false

offset  -=  temp
if(this.isLeap  ==  false)  this.monCyl  ++
}

if(offset==0  &&  leap>0  &&  i==leap+1)
if(this.isLeap)
{  this.isLeap  =  false;  }
else
{  this.isLeap  =  true;  --i;  --this.monCyl;}

if(offset<0){  offset  +=  temp;  --i;  --this.monCyl;  }

this.month  =  i

this.day  =  Math.round( offset  +  1)
}

//==============================传回国历  y年某m+1月的天数
function  solarDays(y,m)  {
if(m==1)
return(((y%4  ==  0)  &&  (y%100  !=  0)  ||  (y%400  ==  0))?  29:  28)
else
return(solarMonth[m])
}
//==============================  传入  offset  传回干支,  0=甲子
function  cyclical(num)  {
return(Gan[num%10]+Zhi[num%12])
}

//==============================  月历属性
function  calElement(sYear,sMonth,sDay,week,lYear,lMonth,lDay,isLeap,cYear,cMonth,cDay,gYear,gMonth,gDay)  {
	this.isPrevious        = false;
this.isToday        =  false;
this.isGooddaya=false;
this.isGooddayb=false;
//国历
this.sYear            =  sYear;
this.sMonth          =  sMonth;
this.sDay              =  sDay;
this.week              =  week;
//农历
this.lYear            =  lYear;
this.lMonth          =  lMonth;
this.lDay              =  lDay;
this.isLeap          =  isLeap;
//干支
this.cYear            =  cYear;
this.cMonth          =  cMonth;
this.cDay              =  cDay;
//吉日
this.gYear            =  gYear;
this.gMonth          = gMonth;
this.gDay              =  gDay;
this.color            =  '';

this.lunarFestival  =  '';  //农历节日
this.solarFestival  =  '';  //国历节日
this.solarTerms        =  '';  //节气
this.gFestival='';//吉日
}

//=====  某年的第n个节气为几日(从0小寒起算)
function  sTerm(y,n)  {
var  offDate  =  new  Date(  (  31556925974.7*(y-1900)  +  sTermInfo[n]*60000    )  +  Date.UTC(1900,0,6,2,5)  )
return(offDate.getUTCDate())
}

//==============================  传回月历物件  (y年,m+1月)
function  calendar(y,m)  {

var  sDObj,  lDObj,  lY,  lM,  lD=1,  lL,  lX=0,  tmp1,  tmp2
var  lDPOS  =  new  Array(3)
var  n  =  0
var  firstLM  =  0

sDObj  =  new  Date(y,m,1)                        //当月一日日期

this.length        =  solarDays(y,m)        //国历当月天数
this.firstWeek  =  sDObj.getDay()        //国历当月1日星期几


for(var  i=0;i<this.length;i++)  {

if(lD>lX)  {
sDObj  =  new  Date(y,m,i+1)        //当月一日日期
lDObj  =  new  Lunar(sDObj)          //农历
lY        =  lDObj.year                      //农历年
lM        =  lDObj.month                    //农历月
lD        =  lDObj.day                        //农历日
lL        =  lDObj.isLeap                  //农历是否闰月
lX        =  lL?  leapDays(lY):  monthDays(lY,lM)  //农历当月最後一天

if(n==0)  firstLM  =  lM
lDPOS[n++]  =  i-lD+1
}

//sYear,sMonth,sDay,week,
//lYear,lMonth,lDay,isLeap,
//cYear,cMonth,cDay
this[i]  =  new  calElement(y,  m+1,  i+1,  nStr1[(i+this.firstWeek)%7],
lY,  lM,  lD++,  lL,
cyclical(lDObj.yearCyl)  ,cyclical(lDObj.monCyl),  cyclical(lDObj.dayCyl++),y,  m+1,  i+1  )


if((i+this.firstWeek)%7==0)      this[i].color  =  'blue'    //周日颜色
if((i+this.firstWeek)%7==6)  this[i].color  =  'blue'    //周6颜色
if(i<tD-1&&y==tY&&m==tM)
this[i].isPrevious=true;
if(y==tY&&m<tM)this[i].isPrevious=true;
if(y<tY )this[i].isPrevious=true;
}

//节气
tmp1=sTerm(y,m*2    )-1
tmp2=sTerm(y,m*2+1)-1
this[tmp1].solarTerms  =  solarTerm[m*2]
this[tmp2].solarTerms  =  solarTerm[m*2+1]
//if(m==3)  this[tmp1].color  =  'red'  //清明颜色

 
//吉日

for(i  in  gFtv)
if(gFtv[i].match(/^(\d{4})(\d{2})(\d{2})([\s\*])(.+)$/))
if(Number(RegExp.$1)==y&&Number(RegExp.$2)==(m+1))  {

this[Number(RegExp.$3)-1].gFestival  += RegExp.$5  +  ' <br/> '
if(RegExp.$4=='*')  {
this[Number(RegExp.$3)-1].isGooddaya=true;
this[Number(RegExp.$3)-1].color='red'
 
}
else {
this[Number(RegExp.$3)-1].isGooddayb=true
}


}

 
 

 

//今日
if(y==tY  &&  m==tM)  this[tD-1].isToday  =  true;
 
}

//======================  中文日期
function  cDay(d){
var  s;

switch  (d)  {
case  10:
s  =  '初十';  break;
case  20:
s  =  '二十';  break;
break;
case  30:
s  =  '三十';  break;
break;
default  :
s  =  nStr2[Math.floor(d/10)];
s  +=  nStr1[d%10];
}
 
return( s);
}
var  cld;

function  drawCld(SY,SM)  {
var  i,sD,s,size;
cld  =  new  calendar(SY,SM);


if(SY>1949)  yDisplay  =  '共和国'  +  (((SY-1949)==1)?'元':SY-1949)
 
<c:if test="${lang eq 'local'}"> GZ.innerHTML  = '【'+Animals[(SY-4)%12]+'】'; </c:if>
 



for(i=0;i<42;i++)  {

sObj=eval('SD'+  i);
//lObj=eval('LD'+  i);

sObj.className  =  '';

sD  =  i  -  cld.firstWeek;



if(sD>-1  &&  sD<cld.length)  {  //日期内
	sObj.innerHTML=sD+1;
	sObj.href=sObj.href+"&SD="+(sD+1);
//sObj.innerHTML  = '<a  style="font-size:13px;font-weight:bold;" href="${url}" <c:if test="${lang eq 'en'}">title="click me and view the correspondent events"</c:if> <c:if test="${lang eq 'local'}">title="点击后可查年当天事件"</c:if>  >'+( sD+1)+'</a>';
sObj.style.color  =  cld[sD].color; 
<c:if test="${not empty param.SD}">
if(sD+1==${param.SD}) sObj.style.background=   '#e1e1e1';
</c:if>
if(cld[sD].isPrevious)  sObj.style.color =   '#808080';
else 
if(cld[sD].isToday)  sObj.className =  'todyaColor';  //今日颜色
else if(cld[sD].isGooddaya) sObj.className  =  'gooddayColora'; 
else if(cld[sD].isGooddayb) sObj.className  =  'gooddayColorb'; 

 //国定假日颜色

//if(cld[sD].lDay==1)  //显示农历月
//lObj.innerHTML  =  '<b>'+(cld[sD].isLeap?'闰':'')  +  cld[sD].lMonth  +  '月'  +  (monthDays(cld[sD].lYear,cld[sD].lMonth)==29?'小':'大')+'</b>';
//else  //显示农历日
//lObj.innerHTML  =  cDay(cld[sD].lDay);


s=cld[sD].lunarFestival;

if(s.length>0)  {  //农历节日
if(s.length>6)  s  =  s.substr(0,  4)+'…';
//s  =  s.fontcolor('red');
}
else  {  //国历节日
s=cld[sD].solarFestival;


if(s.length>0)  {
size  =  (s.charCodeAt(0)>0  &&  s.charCodeAt(0)<128)?8:4;
if(s.length>size+2)  s  =  s.substr(0,  size)+'…';
//if(s.length>0)  s  =  s.fontcolor('black');
}

else  {  //廿四节气
s=cld[sD].solarTerms;
//if(s.length>0)  s  =  s.fontcolor('limegreen');
}
}


//if(s.length>0)  lObj.innerHTML  =  s;

}
else  {  //非日期
sObj.innerHTML  =  '';
//lObj.innerHTML  =  '';
}
}
}


function  changeCld()  {
var  y,m;
y=CLD.SY.selectedIndex+1900;
m=CLD.SM.selectedIndex;
drawCld(y,m);
}

function  pushBtm(K)  {
switch  (K){
case  'YU'  :
if(CLD.SY.selectedIndex>0)  CLD.SY.selectedIndex--;
break;
case  'YD'  :
if(CLD.SY.selectedIndex<149)  CLD.SY.selectedIndex++;
break;
case  'MU'  :
if(CLD.SM.selectedIndex>0)  {
CLD.SM.selectedIndex--;
}
else  {
CLD.SM.selectedIndex=11;
if(CLD.SY.selectedIndex>0)  CLD.SY.selectedIndex--;
}
break;
case  'MD'  :
if(CLD.SM.selectedIndex<11)  {
CLD.SM.selectedIndex++;
}
else  {
CLD.SM.selectedIndex=0;
if(CLD.SY.selectedIndex<149)  CLD.SY.selectedIndex++;
}
break;
default  :
CLD.SY.selectedIndex=tY-1900;
CLD.SM.selectedIndex=tM;
}
changeCld();
}



var  Today  =  new  Date();
var  tY  =  Today.getFullYear();
var  tM  =  Today.getMonth();
var  tD  =  Today.getDate();
//////////////////////////////////////////////////////////////////////////////

var  width  =  "350";
var  offsetx  =  2;
var  offsety  =  16;

var  x  =  0;
var  y  =  0;
var  snow  =  0;
var  sw  =  0;
var  cnt  =  0;

var dStyle  ;
//document.onmousemove  =  mEvn;

//显示详细日期资料
function  mOvr(v)  {
var  s,festival;
var  sObj=eval('SD'+  v);
var  d=sObj.innerHTML-1;
//var mainFrame=document.getElementById("main");    
//mainFrame.style.background=" red";
//mainFrame.style.display =  "none" ;  
var detailFrame=document.getElementById("detail"); 
var listFrame=document.getElementById("list");
detailFrame.style.display =  "" ;  
 
detailFrame.style.left = getXPos(list)+2 ;
detailFrame.style.width=list.style.width;
detailFrame.style.top = getYPos(list);  
//var detailBackFrame=document.getElementById("detail-back"); 
//detailBackFrame.style.display =  "" ;  
//sYear,sMonth,sDay,week,
//lYear,lMonth,lDay,isLeap,
//cYear,cMonth,cDay

if(sObj.innerHTML!='')  {



if(cld[d].solarTerms  ==  ''&&  cld[d].gFestival  ==  ''  &&  cld[d].solarFestival  ==  ''  &&  cld[d].lunarFestival  ==  '')
festival  =  '';
else
festival  =  '<TR><TD width=100% colspan=2>'+
'<FONT    STYLE="font-size:9pt;">'+cld[d].gFestival  +  '  ' +'</FONT></TD>'+'</TR>';

s=  '<TABLE valign=top WIDTH="100%"  style="  border:#d4d2d4 0px solid;" CELLPADDING="0"  CELLSPACING=0  align=center  ><tr bgcolor=orange><td width=70%><img src="/group/images/winlogo.gif" border=0 >&nbsp;<FONT    STYLE="font-size:10pt;font-weight:bold;">';
<c:if test="${lang   eq 'local'}"> 
s=s+
cld[d].sYear+'  年  '+cld[d].sMonth+'  月  '+cld[d].sDay+'  日      星期'+cld[d].week+'</FONT> </td><td height=25 align=right width=30%><a href="#" onClick="showMain()"><img src="/group/images/close.gif" style="cursor:pointer" border=0/></a></td></tr>'  ;
</c:if>
<c:if test="${lang   eq 'en'}"> 
s=s+
cld[d].sYear+'-'+cld[d].sMonth+'-'+cld[d].sDay+'  '+cld[d].week+'</FONT> </td><td height=25 align=right width=30%><a href="#" onClick="showMain()"><img src="/group/images/close.gif" class=close border=0/></a></td></tr>'  ;
</c:if>
<c:if test="${lang   eq 'local'}"> 
s=s+
'<TR><TD  ALIGN="right" width=100% colspan=2>'+
'<font  STYLE="font-size:9pt;">农历'+(cld[d].isLeap?'闰  ':'  ')+cld[d].lMonth+'  月  '+cld[d].lDay+'  日</font>'+
'</TD></TR> ';
</c:if>
s=s+  festival  +'</TABLE>';
 
//document.all["detail"].innerHTML  =  s;
detailFrame.innerHTML=s;
 
}
}


 

/////////////////////////////////////////////////////////



function  showAll(){
	var mainFrame=document.getElementById("all"); 
 if(mainFrame.contains(event.toElement)) return;
	var detailFrame=document.getElementById("detail"); 
	detailFrame.style.display =  "none" ;  
	var detailBackFrame=document.getElementById("detail-back"); 
	detailBackFrame.style.display =  "none" ;  
	
}
function  showMain(){
 
	var detailFrame=document.getElementById("detail"); 
	detailFrame.style.display =  "none" ;  
	var detailBackFrame=document.getElementById("detail-back"); 
	detailBackFrame.style.display =  "none" ;  
	
}
function  showFirst(code)  {

var list=	document.getElementById("div"+code); 
var secondSelect=	document.getElementById("secondSelect"); 
var inputs=list.getElementsByTagName("input");
var initLen=secondSelect.length;
 

secondSelect.length=0;

var defaultOption=new Option("${context.msg_select_topic}","0");
 

  secondSelect.options.add(defaultOption);
 

  for ( var i=0; i<inputs.length; i++ )
{ 

		   
		 
		   var flag=1;

		   if(flag==1){
	    	var objOption=document.createElement("OPTION");
	    	   objOption.value=inputs[i].name;
	    	   objOption.text=inputs[i].value;
	    	   secondSelect.options.add(objOption);
		   }

	     
	 

}
}
 
 
function  initial()  {
	//dStyle  = detail.style;
	//detail.style.top  =70;
	//detail.style.left  =405;
	CLD.SY.selectedIndex=<c:out value="${inputYear-1}" />-1900;
	CLD.SM.selectedIndex=<c:out value="${inputMonth}" />;
	drawCld(<c:out value="${inputYear}" />,<c:out value="${inputMonth}" />);
	//CLD.SY.selectedIndex=tY-1900;
	//CLD.SM.selectedIndex=tM;
	//drawCld(tY,tM);


	}

function  click(v)  {
	var  s,festival;
	var  sObj=eval('SD'+  v);
	var  d=sObj.innerHTML-1;
	//var mainFrame=document.getElementById("main");    
	//mainFrame.style.background=" red";
	//mainFrame.style.display =  "none" ;  
	var detailFrame=document.getElementById("detail"); 
	var listFrame=document.getElementById("list");
	detailFrame.style.display =  "" ;  
	 
	detailFrame.style.left = getXPos(list)+2 ;
	detailFrame.style.width=list.style.width;
	detailFrame.style.top = getYPos(list);  
	var detailBackFrame=document.getElementById("detail-back"); 
	detailBackFrame.style.display =  "" ;  
	//sYear,sMonth,sDay,week,
	//lYear,lMonth,lDay,isLeap,
	//cYear,cMonth,cDay

	if(sObj.innerHTML!='')  {



	if(cld[d].solarTerms  ==  ''&&  cld[d].gFestival  ==  ''  &&  cld[d].solarFestival  ==  ''  &&  cld[d].lunarFestival  ==  '')
	festival  =  '';
	else
	festival  =  '<TR><TD width=100% colspan=2>'+
	'<FONT  COLOR="black"  STYLE="font-size:9pt;">'+cld[d].gFestival  +  '  ' +'</FONT></TD>'+'</TR>';

	s=  '<TABLE valign=top WIDTH="100%"  style="  border:#d4d2d4 0px solid;" CELLPADDING="0"  CELLSPACING=0  align=center  ><tr bgcolor=orange><td width=70%><img src="/group/images/winlogo.gif" border=0 >&nbsp;<FONT    STYLE="font-size:10pt;font-weight:bold;">';
	<c:if test="${lang   eq 'local'}"> 
	s=s+
	cld[d].sYear+'  年  '+cld[d].sMonth+'  月  '+cld[d].sDay+'  日      星期'+cld[d].week+'</FONT> </td><td height=25 align=right width=30%><a href="#" onClick="showMain()"><img src="/group/images/close.gif" class=close border=0/></a></td></tr>'  ;
	</c:if>
	<c:if test="${lang   eq 'en'}"> 
	s=s+
	cld[d].sYear+'-'+cld[d].sMonth+'-'+cld[d].sDay+'  '+cld[d].week+'</FONT> </td><td height=25 align=right width=30%><a href="#" onClick="showMain()"><img src="/group/images/close.gif" class=close border=0/></a></td></tr>'  ;
	</c:if>
	<c:if test="${lang   eq 'local'}"> 
	s=s+
	'<TR><TD  ALIGN="right" width=100% colspan=2>'+
	'<font  STYLE="font-size:9pt;">农历'+(cld[d].isLeap?'闰  ':'  ')+cld[d].lMonth+'  月  '+cld[d].lDay+'  日</font>'+
	'</TD></TR> ';
	</c:if>
	s=s+  festival  +'</TABLE>';
	 
	//document.all["detail"].innerHTML  =  s;
	detailFrame.innerHTML=s;
	 
	}
	}

</script>
<STYLE>
.todyaColor {
	BACKGROUND-COLOR: #B4C864
}

.previousColor {
	FONT-COLOR: #808080
}
</STYLE>

<STYLE>
.gooddayColora {
	FONT-COLOR: #B4C864
}
</STYLE>

<STYLE>
.gooddayColorb {
	BACKGROUND-COLOR: yellow
}
</STYLE>
</head>
<BODY STYLE='OVERFLOW: SCROLL; OVERFLOW-X: HIDDEN' onload="initial()">


<c:import url="/group/ui-component/divdialog/divdialog.html" />


<div id=all style="width: 100%" onmouseout="showAll()">
<div id=detail
	style="display: none; position: absolute; top: 20%; left: 25%; width: 400; height: 300px; padding: 0px; border: 1px solid orange; background-color: white; z-index: 1002; overflow: hidden;">
</div>
<div id="detail-back"
	style="display: none; position: absolute; top: 0%; left: 0%; width: 100%; height: 100%; background-color: #f3f3f3; z-index: 1001; -moz-opacity: 0.8; opacity: .80; filter: alpha(opacity =                 80);">
</div>
<div id="main" style="width: 100%"><c:set var='nextYear'
	value='${inputYear}' /> <c:set var='nextMonth'
	value='${inputMonth +2}' /> <c:set var='lastMonth'
	value='${inputMonth }' /> <c:set var='lastYear' value='${inputYear }' />
<c:if test='${nextMonth==13 }'>
	<c:set var='nextYear' value='${inputYear+1}' />
	<c:set var='nextMonth' value='1' />
</c:if> <c:if test='${lastMonth==0 }'>
	<c:set var='lastYear' value='${inputYear-1}' />
	<c:set var='lastMonth' value='12' />
</c:if> <script type="text/javascript"
	src="/group/ui-component/calendar/js/calendar.js"></script>
<table width=100% align=left style="border-bottom: 0px solid #EDEDED"
	cellSpacing=0 cellPadding=0>

	<tr>
		<td width=100%>


		<FORM name=CLD>


		<TABLE cellpadding="0" cellspacing="0" width=100% >

			<TBODY>
				<tr>
					<td class="c_top" colspan=2></td>
				</tr>
				<tr>
					<td colspan=2 class="c_bottom"></td>
				</tr>
				<c:if test="${not empty  eventDirectory}">
					<tr>
						<td colspan=2 align=center><b>${eventDirectory.name }</b></td>
					</tr>
				</c:if>

				<TR>
					<td nowrap>
					<form name=reminderForm
						aciton="/group/event<c:out value="${context.postfix}&showMine=${param.showMine}" />">
					<c:if test="${not empty eventUserName }">
						<input type=hidden name=userName value='${eventUserName}' />
					</c:if> <c:if test="${not empty param.directoryID }">
						<input type=hidden name=directoryID value='${param.directoryID}' />
					</c:if>
					<table width=100% >
						<tr>
							<td align=left nowrap>&nbsp;&nbsp;&nbsp;&nbsp; <font
								style="font-size: 28px;"><b> <c:out
								value="${inputMonth+1}" /></b> </font></td>
							<td nowrap width=300 align=right>&nbsp;&nbsp; <FONT
								style="FONT-SIZE: 10pt" size=2> <c:url
								value="event${context.postfix}" var="lastMonthUrl">
								<c:param name='SY' value='${lastYear}' />
								<c:param name='SM' value='${lastMonth}' />
								<c:if test="${not empty param.showMine }">
									<c:param name='showMine' value='${param.showMine}' />
								</c:if>
								<c:if test="${not empty param.directoryID }">
									<c:param name='directoryID' value='${param.directoryID}' />
								</c:if>
								<c:if test="${not empty eventUserName }">
									<c:param name='userName' value='${eventUserName}' />
								</c:if>
								<c:if test="${not empty param.showFavourite }">
									<c:param name='showFavourite' value='${param.showFavourite}' />
								</c:if>
							</c:url> <a href="/group/${lastMonthUrl}" title="${context.last_month}"><<</a>&nbsp;<SELECT
								style="FONT-SIZE: 10pt" onchange="this.form.submit()" name=SY>


								<%
									for (int i = 1901; i < 2050; i++) {
								%>
								<option value=<%=i%>><%=i%> <c:if
									test="${lang   eq 'local'}">年</c:if> <%
 	}
 %>
								
							</SELECT> &nbsp; <SELECT style="FONT-SIZE: 10pt"
								onchange="this.form.submit()" name=SM>
								<%
									for (int i = 1; i < 13; i++) {
								%>
								<option value=<%=i%>><%=i%> <c:if
									test="${lang eq 'local'}">月</c:if> <%
 	}
 %>
								
							</SELECT></FONT>&nbsp;<c:url value="event${context.postfix}" var="nextMonthUrl">
								<c:param name='SY' value='${nextYear}' />
								<c:param name='SM' value='${nextMonth}' />
								<c:if test="${not empty param.showMine }">
									<c:param name='showMine' value='${param.showMine}' />
								</c:if>
								<c:if test="${not empty eventUserName }">
									<c:param name='userName' value='${eventUserName}' />
								</c:if>
								<c:if test="${not empty param.showFavourite }">
									<c:param name='showFavourite' value='${param.showFavourite}' />
								</c:if>
								<c:if test="${not empty param.directoryID }">
									<c:param name='directoryID' value='${param.directoryID}' />
								</c:if>
							</c:url> <a href="/group/${nextMonthUrl}" title="${context.next_month}">>></a>
							&nbsp;<FONT id=GZ style="FONT-SIZE: 11pt"></FONT></td>
						</tr>
					</table>
					</form>
					</td>
					<td align=center>&nbsp; <c:if test="${not empty param.directoryID }"><input type=button
						onclick="<c:if test='${not empty session_user }'>showAddControl();</c:if><c:if test='${ empty session_user }'>parent.showLoginWin();</c:if>"
						style="border: 0px; cursor: pointer; height: 25px; font-size: 13px; color: #ffffff; background: #36518B;"
						value="<c:out
												value='${context.add_event}' />">&nbsp;
					<div id="addControl"
						style="display: none; scrolling: auto; valign: center; position: absolute; top: 15%; left: 20%; width: 650px; padding: 0px; border: 1px solid orange; background-color: white; z-index: 1002; overflow: hidden;">
					<form name="AddMessageForm"
						onSubmit="return checkAddMessageForm();" method=post
						action="/group/event.action?directoryID=${param.directoryID}">
					<input type=hidden name=cmd value="addGmessage">
					<table align=center cellspacing=0 cellpadding=0
						style="border: 1px solid #d4d2d4;" width=100%>

						<tr bgcolor="orange">
							<td nowrap><img src="/group/images/winlogo.gif" border=0>&nbsp;<b><c:out
								value='${context.add_event}' /></b></td>
							<td align=right><img src="/group/images/close.gif"
								style="cursor: pointer" onClick="hideDivControl('addControl')"
								border=0 /></td>
						</tr>
						<tr bgcolor="#ffffff">
							<TD style="height: 25px;"><c:out
								value='${context.msg_title}' /></td>
							<td><input type=text name=name size=60 maxlength=500>
							</TD>
						</TR>
						<tr bgcolor="#ffffff">
							<TD align=left style="height: 25px;"><c:out
								value='${context.msg_topic}' /></td>
							<td><c:set var="eventGroups"
								value="${eventDirectory.id}groups" /> <c:forEach var="group"
								items="${requestScope[eventGroups]}">
								<div id="div${group.id }" style="display: none;"><c:set
									var="eventTopics" value="${group.id}topics" /> <c:forEach
									var="eventTopic" items="${requestScope[eventTopics] }">
									<input type=hidden id="topic${eventTopic.id}"
										name="${eventTopic.id}" value="${eventTopic.name}" />

								</c:forEach></div>
							</c:forEach> <select id="firstSelect"
								onchange="showFirst(this.options[this.options.selectedIndex].value) ">
								<option value="-1"><c:out
									value='${context.msg_select_topic}' /></option>
								<c:forEach var="group" items="${requestScope[eventGroups]}">
									<option value='<c:out value="${group.id}" />'><c:out
										value="${group.name}" /></option>
								</c:forEach>




							</select> - <select id="secondSelect" name=tid>
								<option value="-1"><c:out
									value='${context.msg_select_topic}' /></option>

							</select></TD>
						</TR>



						<tr bgcolor="#ffffff">
							<td align="left" style="height: 25px;"><c:out
								value='${context.text_start}' /></td>
							<td><input type=text readonly="readonly"
								onClick="showcalendar(event, this);"
								onFocus="showcalendar(event, this);if(this.value=='0000-00-00')this.value=''"
								name="source" size=25 maxlength=200></TD>
						</TR>


						<tr bgcolor="#ffffff">
							<td align="left" style="height: 25px;"><c:out
								value='${context.text_end}' /></td>
							<td><input type=text readonly="readonly"
								onClick="showcalendar(event, this);"
								onFocus="showcalendar(event, this);if(this.value=='0000-00-00')this.value=''"
								name="stime" size=25 maxlength=40></TD>
						</TR>
						<!-- 
								<tr bgcolor="#ffffff">
									<td align="left"><c:out value='${context.text_abstract}' /></td>
									<td style="height:45px;"><textarea id="abstract" name=tag cols="65" rows="2"
										class="textarea"></textarea></TD>
								</TR>
                                -->
						<tr bgcolor="#ffffff">
							<TD width=100% style="height: 25px" align=center colspan=2><textarea
								id="content" name=content cols="60" rows="40"></textarea></TD>
						</TR>


						<tr bgcolor="#ffffff">

							<TD align=center colspan=2><input type=submit
								style="cursor: pointer;"
								value="<c:out value='${context.button_ok}' />">&nbsp;&nbsp;<input
								type=button onclick="hideDivControl('addControl')"
								style="cursor: pointer;"
								value="<c:out value='${context.button_cancel}'  />"></TD>
						</TR>


					</table>
					</form>
					</div></c:if>
					&nbsp;&nbsp;</TD>
				</TR>


				<script>

   var firstSelect=document.getElementById("firstSelect");
   firstSelect.options.selectedIndex=0;

 
   </script>


				<TR>


					<TD style="border: solid #d4d4d4 1px;" width=50%>

					<TABLE cellpadding="0" cellspacing="0" width=100%
						style="table-layout: fixed">


						<TR height=20 align=center bgcolor="#f3f3f3">
							<TD width=14%><c:out value="${context.Sun}" /></TD>
							<TD width=14%><c:out value="${context.Mon}" /></TD>
							<TD width=14%><c:out value="${context.Tue}" /></TD>
							<TD width=14%><c:out value="${context.Wed}" /></TD>
							<TD width=14%><c:out value="${context.Thu}" /></TD>
							<TD width=14%><c:out value="${context.Fri}" /></TD>
							<TD width=14%><c:out value="${context.Sat}" /></TD>
						</TR>



						<SCRIPT language=JavaScript>

<c:set var="gNum" value="0" />
<c:forEach var="i" begin="0" end="5" step="1">
 
document.write('<tr align=center   >')
<c:forEach var="j" begin="0" end="6"  step="1">
<c:set var="gNum" value="${i*7+j}" /> 
<c:set var="url"
	value="/group/event${context.postfix}?v=p" />
<c:if test='${not empty (param.SY) }'>
	<c:set var="url" value="${url }&SY=${param.SY}" />
</c:if>
<c:if test='${not empty (param.SM) }'>
	<c:set var="url" value="${url }&SM=${param.SM}" />
</c:if>
 
<c:if test='${not empty (param.directoryID) }'>
	<c:set var="url" value="${url }&directoryID=${param.directoryID}" />
</c:if>
<c:if test='${not empty (param.showFavourite) }'>
	<c:set var="url" value="${url }&showFavourite=${param.showFavourite}" />
</c:if>
<c:if test='${not empty (param.showMine) }'>
	<c:set var="url" value="${url }&showMine=${param.showMine}" />
</c:if>
document.write('<td   style="height:60px;"  >  <a <c:if test="${lang eq 'en'}">title="click me and view the correspondent events"</c:if> <c:if test="${lang eq 'local'}">title="点击后可查看当天起的事件"</c:if> href="${url}" id="SD${gNum}"     style="font-size:15pt;font-weight:bold;"  face="Arial  Black" TITLE="">  </a>')

document.write('</td>')
</c:forEach> 
document.write('</tr>')
</c:forEach>
</SCRIPT>

						<tr>
						</tr>

					</TABLE>

					</TD>
					<td valign=top width=55%>

					<div
						style="OVERFLOW-Y: auto; border-top: 1px solid #d2d4d2; border-bottom: 1px solid #d2d4d2; border-right: 1px solid #d2d4d2; width: 100%; HEIGHT: 400px">


					<c:import url="/group/eventMessages.jsp" /></div>






					</td>

				</TR>
			</TBODY>
		</TABLE>
		</FORM>

		</td>
	</tr>
	<tr>
		<td></td>
	</tr>
</table>
</div>

</div>
<c:if test="${not empty msg}">
	<script>alert('${msg }')</script>
</c:if>
</body>


</html>

